﻿<Table TItem="BindItem"
       IsPagination="true" PageItemsSource="@PageItemsSource"
       IsStriped="true" IsBordered="true" IsMultipleSelect="true"
       ShowToolbar="true" ShowExtendButtons="true" ShowSkeleton="true"
       OnQueryAsync="@OnEditQueryAsync"
       OnAddAsync="@OnAddAsync" OnSaveAsync="@OnSaveAsync" OnDeleteAsync="@OnDeleteAsync">
    <TableColumns>
        <TableColumn @bind-Field="@context.DateTime" Filterable="true" Sortable="true" />
        <TableColumn @bind-Field="@context.Name" Filterable="true" Sortable="true">
            <EditTemplate Context="value">
                <div class="form-group col-12 col-sm-6">
                    <TablesNameDrop Model="@((BindItem)value)" />
                </div>
            </EditTemplate>
        </TableColumn>
        <TableColumn @bind-Field="@context.Address" />
        <TableColumn @bind-Field="@context.Education" />
        <TableColumn @bind-Field="@context.Count" />
        <TableColumn @bind-Field="@context.Complete">
            <Template Context="v">
                <Switch IsDisabled="true" Value="v.Value" />
            </Template>
            <EditTemplate Context="v">
                <div class="form-group col-12 col-sm-6">
                    <Switch @bind-Value="(v as BindItem)!.Complete" />
                </div>
            </EditTemplate>
        </TableColumn>
    </TableColumns>
</Table>

@code {
    // 为了避免代码重复请查看其他示例的 c# 代码
    // TablesNameDrop 为自定义组件
    // https://gitee.com/LongbowEnterprise/BootstrapBlazor/blob/dev/src/BootstrapBlazor.Shared/Pages/Table/TablesNameDrop.razor
}
